
package com.qdu.dao;

import com.qdu.util.DatabaseUtil;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

/**
 *
 * @author Lenovo
 */
public class UpManagerDao {
    
        private static int SUCCESS=1;
	private static int ERROR=2;
	private static int SAME=3;
        
    
       	public int upManager(int admin_id,String admin_password){
              Connection con = null;
              PreparedStatement ps = null;
              ResultSet rs = null;
		
		try{	
                    con = DatabaseUtil.getConnection();
                    ps = con.prepareStatement("update systemadministrator set admin_password=? where admin_id=?");
                    ps.setString(1, admin_password);
                    ps.setInt(2, admin_id);
				int i=ps.executeUpdate();
				if(i==1){
					return this.SUCCESS;
				}
				else{
					return this.ERROR;
				}			
		}catch(Exception e){
			e.printStackTrace();
			return this.ERROR;
		}finally{
			   DatabaseUtil.close(rs, ps, con);
		}
	}
	
        
}
